package com.zhao.lagou.loginintercept.config;

import com.zhao.lagou.loginintercept.interceptor.RequestInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Component
public class InterceptorConfig implements WebMvcConfigurer {

    RequestInterceptor requestInterceptor;

    @Autowired
    public void setRequestInterceptor (RequestInterceptor requestInterceptor) {
        this.requestInterceptor = requestInterceptor;
    }


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(requestInterceptor).addPathPatterns("/toMain").excludePathPatterns("/toLogin","/loginSystem");
    }
}
